package com.hnzq.cloud;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.hnzq.cloud.dto.PageUsersDto;
import com.hnzq.cloud.dto.RegisterDto;
import com.hnzq.cloud.dto.UserDto;
import com.hnzq.cloud.model.Result;
import com.hnzq.cloud.param.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


@FeignClient(value = "fresh-user-assembly",contextId = "UserAPI",path = "FreUser")
public interface UserAPI {


    /**
     * 未登录跳转的页面
     * @return
     */
    @GetMapping("noneLogin")
    public Result noneLogin();


    /**
     * 注册及新增
     * @param registerParam
     * @return
     */
    @PostMapping("register")
    public Result<RegisterDto> register(@RequestBody RegisterParam registerParam) ;


    /**
     * 分页条件查询用户
     * @param findUsersParam
     * @return
     */
    @GetMapping("findUsersByCondition")
    public Result<PageUsersDto> findUsersByCondition(@RequestBody FindUsersParam findUsersParam);



    /**
     * 更新用户
     * @param updateUserParam
     * @return
     */
    @PutMapping("updateUserById")
    public Result<UserDto> updateUserById(@RequestBody UpdateUserParam updateUserParam) throws JsonProcessingException;


    /**
     * 删除用户
     * @param deleteUserParam
     * @return
     */
    @DeleteMapping("deleteUserById")
    public Result<Boolean> deleteUserById(@RequestBody DeleteUserParam deleteUserParam) throws JsonProcessingException;



    /**
     * 后台增加用户积分
     * @param addUserScoreParam
     * @return
     */
    @PutMapping("addUserScore")
    public Result<Boolean> addUserScore(@RequestBody AddUserScoreParam addUserScoreParam) throws JsonProcessingException;


    /**
     * 后台计算用户等级
     * @param userLevelParam
     * @return
     */
    @PutMapping("caculateUserLevel")
    public Result<Boolean> caculateUserLevel(@RequestBody UserLevelParam userLevelParam) throws JsonProcessingException;




    /**
     * 登录
     * @param accountName
     * @param accountPassword
     * @return
     */
    @GetMapping("login")
    public Result login(@RequestParam("accountName")String accountName
            ,@RequestParam("accountPassword")String accountPassword);


    /**
     * 登出
     * @return
     */
    @GetMapping("loginOut")
    Result loginOut();



}
